<?php
	include("includes/secure.php");
	include("includes/config.php");
	include("includes/class/parafiscal_company.class.php");
	
	$parafiscal_company = new Parafiscal_company(); 	
	
	$msg_info = $msg_alert = $msg_error = false;
	$_SESSION['msg_cool'] = '';
	$show_msg = 0;
			
	if(isset($_POST['addParafiscalCompany']) && $_POST['addParafiscalCompany'] == 1){
		$action = $_POST["action"];
		$data->paco_name = trim(mysql_real_escape_string($_POST['paco_name']));
		$data->paco_porc = $_POST['paco_porc'];
		
	
		if ($data=$parafiscal_company->addParafiscalCompany($data) ){
			$msg_info = true;
			$_SESSION["msg_cool"] .= 'El parafiscal fue adicionado satisfactoriamente!!.<br />';
			echo "<script> window.location.href='listParafiscalCompany.php?show_msg=3'</script>";
				
		}
		else{
			$msg_info = true;
			$_SESSION["msg_cool"] .= 'No pudo ser adicionado el parafiscal!.<br />';
			echo "<script> window.location.href='listParafiscalCompany.php?show_msg=1'</script>";
		}
	}
	
	if ( $msg_error )
		$show_msg = 1;
	elseif ( $msg_alert )
		$show_msg = 2;
	elseif ( $msg_info )
		$show_msg = 3;
?>